<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=8">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta content="B2B电商平台" name="description" />
		<meta content="B2B电商平台" name="keyword" />

		<title>B2B电商平台.订单复核</title>
		<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
		<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/include/css/global.css" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/include/css/style.css" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/include/css/pro.css" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/include/css/proManage.css" />
		<link rel="stylesheet" href="<%=path%>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css"
			type="text/css"></link>
		<link rel="stylesheet" type="text/css" href="<%=path%>/include/pagination/page.css" media="all">
		<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />	
		<link rel="stylesheet" type="text/css" href="<%=path%>/include/sweetalert/sweetalert.css" />
		<script type="text/javascript" src="<%=path%>/include/js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="<%=path%>/include/js/cookies.js"></script>
		<script type="text/javascript" src="<%=path%>/include/js/icss.busin.js"></script>
		<script type="text/javascript" src="<%=path%>/include/JQuery ui/js/jquery-ui-1.7.3.custom.min.js"></script>
		<script type="text/javascript" src="<%=path%>/include/js/icss.common.js"></script>
		<script type="text/javascript" src="<%=path%>/include/pagination/jquery.pagination.js"></script>
		<script type="text/javascript" src="<%=path%>/include/pagination/init.js"></script>
		<script type="text/javascript" src="<%=path%>/include/js/doT.min.js"></script>
		<script src="<%=path%>/include/DatePicker/WdatePicker.js" charset="UTF-8" type="text/javascript"></script>
		<script type="text/javascript" src="<%=path%>/include/sweetalert/sweetalert.min.js"></script>
		<script type="text/javascript" src="<%=path%>/include/sweetalert/sweetalert-dev.js"></script>
		<style type="text/css">
.table tr td {
	border-left: 1px solid #ddd;
	border-bottom: 1px solid #ddd;
	height: 33px;
}

.table tr th {
	border-left: 1px solid #ddd;
	font-weight: bold;
}
em.create {
    background-position: -50px -44px;
    line-height: 28px;
    display: inline-block;
    font-style: normal;
    background-repeat: no-repeat;
    text-indent: 15px;
    float: right;
    cursor: pointer;
}
.create {
	background: url("<%=path%>/images/coupons/sort_zss.png");
}

#queryId button{
	background-image: url("<%=path%>/include/css/img/xs_bgx.png");
    background-color: transparent;
}
.cxx_btn{
	width: 44px;
    height: 24px;
    background-position: 0px -203px;
    line-height: 24px;
    margin: 0px 0px 0px 5px;
}
a{
	color: #039;
}
#tbody td{
padding: 0px 4px;
vertical-align: middle;
line-height: 20px;
}
.search_lis_se input{
height: 24px;
}
.button_css {
    width: 44px;
    height: 24px;
    line-height: 24px;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border: 0;
    cursor: pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline: none;
    background-image: url('<%=path %>/include/css/img/xs_bgx.png');
}
</style>
		<script type="text/javascript">
	$(function(){
		_search();
	});

	var pagination;
	function _search() {
		var url = "<%=path%>/orderReview/queryOrderReviewList.do";
		var data = {
				begTime :$("#begTime").val(),
				endTime :$("#endTime").val(),
				conName :$("#conName").val(),
				status :$("#status").val()
		};
		pagination = _initPagination({'pageId':'pagination', 'cKey':'toOrderReviewList', 'url': url, 'data': data, 'rows': 10, 'callback':_initDataList});
	}
	
	function _initDataList(data) {
	 	var tpl = $('#dataTpl').html();
		$('#tbody').html(doT.template(tpl)(data.rows));
		_reHeight("rightFrame","contentDiv");
	}	

	function _clear(){
		$("#begTime").val("");
		$("#endTime").val("");
		$("#conName").val("");
		$("#status").val("");
	}
	function _export(){
		 var begTime = $("#begTime").val();
		 var endTime = $("#endTime").val();
		 var conName = $("#conName").val();
		 var status = $("#status").val();
		 var url = "<%=path%>/orderReview/exportOrderReviewList.do?begTime="+begTime+"&endTime="+endTime+"&conName="+conName+"&status="+status;
		 window.open(url);
	 }
	function _checkAll(){
		var checkAll = $("input[name=checkboxAll]").attr("checked");
		if(checkAll=="checked"){
			$("input[name=uuid]").prop("checked", true); 
		}else{
			$("input[name=uuid]").prop("checked", false); 
		}
	}

	function _reviewBatch(){
		var orderIds = "0";
		$("input[name='uuid']:checkbox:checked").each(function(){
			orderIds += ","+$(this).val();
		});
		if(orderIds=="0"){
			parent.swal("请至少选择一个要复核的对象!");
			return;
		}
		orderIds = orderIds.substring(2);
		$.ajax({
			type:"post",
			url:"<%=path%>/orderReview/reviewBatch.do",
			dataType:"text",
			data:{orderIds:orderIds},
			success:function(data){
				if(data=="t"){
					parent.swal("订单复核成功");
					_search();
				}else{
					parent.swal("订单复核失败");
				}
			}
		});
	}
	function _showDetail(orderNo){
		var begTime = $("#begTime").val();
		var endTime = $("#endTime").val();
		var url = "<%=path%>/orderReview/showDetail.do?orderNo="+orderNo+"&begTime="+begTime+"&endTime="+endTime;;
		location.href = url;
	}
</script>
	</head>

	<body style="font-family: '微软雅黑';">
		<div id="contentDiv" style="padding:4px; width:99%;">
			<div class="colnums-2-ab-b">
				<div class="toptil">订单复核列表 </div>
				<div></div>
				<div id="queryId" style="border: 1px solid #e0e0e0;background: #f5f5f5;padding-left:10px;margin-bottom:10px;height: 40px;;line-height: 40px;font-size:14px;">
					支付人:&nbsp;<input id="conName" name="conName" placeholder="请输入支付人" style="width: 130px"/>
					&nbsp;
					收货时间:&nbsp;<input type="text" id="begTime" name="begTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" 
							    	style="width: 100px;height: 24px; padding-left: 3px" onfocus="WdatePicker({position:{left:270,top:86}})" class="Wdate" value="${begTime }"/>
					至 <input type="text" id="endTime" name="endTime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" 
							    	style="width: 100px;height: 24px; padding-left: 3px" onfocus="WdatePicker({position:{left:384,top:86}})" class="Wdate" value="${endTime }"/>
					&nbsp;状态:&nbsp;
					<select id="status" name="status" style="width: 80px;height: 24px;">
						<option value="">全部</option>
						<option value="0">未复核</option>
						<option value="1">已复核</option>
					</select>
					<button class="button_css" type="button" onclick="_search()">查询</button>
					<button class="button_css" type="button" style="display: none;" onclick="_clear()">清空</button>
					<button class="button_css" type="button" onclick="_export()">导出</button>
					<button class="button_css" style="width: 66px;background-size: 180px 458px;" type="button" onclick="_reviewBatch()">批量复核</button>
				</div>
				<div class="row-fluid dataTables_wrapper" >
					<table id="listTable"
						class="table table-hover table-nomargin table-bordered usertable dataTable"
						style="width: 100%; border-spacing: 0;">
						<thead>
							<tr class="trBgd"
								style="background-color: #eee;text-align: center; height: 31px; border: 1px solid #ddd; white-space: nowrap; background-position: 0 -123px; line-height: 30px; font-weight: bold;">
								<th>
									<input type='checkbox' name='checkboxAll' value='' onclick="_checkAll()">
								</th>
								<th>
									订单号（<span style="color: red;">红色表示有退款</span>）
								</th>
								<th>
									支付人
								</th>
								<th>
									时间
								</th>
								<th>
									订单（￥）
								</th>
								<th>
									实付（￥）
								</th>
								<th>
									手续费（￥）
								</th>
								<th>
									到账（￥）
								</th>
								<th>
									状态
								</th>
							</tr>
						</thead>
						<tbody id="tbody" style="font-size: 13px">
						</tbody>
					</table>
					<div class="dataTables_paginate paging_full_numbers">
						<span id="innerHtml"> </span>
					</div>
					<div id="pagination"></div>
					<div>
						<div style="height: 30px;"></div>
						<!-- 分类列表div结束 -->
						<div class="clear"></div>
					</div>
				</div>
				</div>
			</div>
	</body>
	<script type="text/javascript">
	$(document).ready(function(){
			_reHeight("rightFrame","contentDiv");
	 });
</script>
	<script id="dataTpl" type="text/template">
		{{ for (var i = 0; i < it.length; i ++) { }}  
		{{     var row = it[i]; }}
		{{     var rowNumber = _getRowNumber(i); }}
			<tr style='line-height: 30px;white-space: nowrap;'>
				<td style='width: 4%;text-align:center;'>
		{{ if(row.REVIEW_STATUS==0){}}
					<input type='checkbox' name='uuid' value='{{=row.UUID}}' star='3' mainpro=''>
		{{ }else{ }}
					<input type='checkbox' name='uuid1' disabled="disabled" value='{{=row.UUID}}' star='3' mainpro=''>
		{{ }	}}
				</td>
				<td style='width: 20%;'>
		{{ if(row.REFUND_MONEY_STATUS=='有退款'){ }}
					<a style='color:red' href="javaScript:void('')" title='{{=row.REFUND_MONEY_STATUS}}' onclick="_showDetail('{{=row.ORDER_NO}}')">{{=row.ORDER_NO}}</a>
		{{ }else{ }}
					<a href="javaScript:void('')" onclick="_showDetail('{{=row.ORDER_NO}}')">{{=row.ORDER_NO}}</a>
		{{ } }} 
				</td>
				<td style='width: 20%;white-space: normal;'>{{=row.CON_NAME}}</td>
				<td style='width: 10%;text-align:center;'>{{=row.RECEIVING_TIME}}</td>
				<td style='width: 10%;text-align:right;'>{{=row.ORDER_MONEY}}</td>
				<td style='width: 10%;text-align:right;'>{{=row.ORDER_REAL_MONEY}}</td>
				<td style='width: 10%;text-align:right;'>{{=row.ALL_FEE_MONEY}}</td>
				<td style='width: 10%;text-align:right;'>{{=row.REAL_MONEY}}</td>
				<td style='width: 10%;text-align:center;border-right: 1px solid #ddd;'>{{=row.STATUS_NAME}}</td>
		     </tr>
		{{ } }}
	</script>
</html>
